# 对模型进行修改

from transformers import BertModel
import torch

pretrained = BertModel.from_pretrained(
    r"../../my_model_cache/bert-base-chinese/models--bert-base-chinese/snapshots/c30a6ed22ab4564dc1e3b2ecbf6e766b0611a33f")
print(pretrained)

pretrained.embeddings.word_embeddings = torch.nn.Embedding(21130, 768, padding_idx=0)
pretrained.embeddings.position_embeddings = torch.nn.Embedding(1500, 768)
print(pretrained)
